#!/bin/bash

echo_red() {
    echo -e "\033[31m$@\033[0m"
}

# Check that Cargo.lock does not have unstaged changes
if [ "$(git status | grep Cargo.lock | wc -l |  tr -d '[[:space:]]')" != "0" ]
then
    echo_red "Changes detected in Cargo.lock after building"
    echo_red "Please rebuild the project locally and commit Cargo.lock."

    git --no-pager diff Cargo.lock

    exit 1
fi

exit 0

